Show pinned articles in the articles list if 4 are already selected #942
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey!
This PR proposes a small change that will include pinned articles in the regular articles list if there are more than 4 pinned articles.
For a bit of context, I have 19 articles published on laravel.io. However, you can only actually see 18 (or at least that's all I can see haha). One of them is in the pined list at the top. The other 17 are in the regular articles list. From what I can gather, I think it's because this article is currently pinned: https://laravel.io/articles/how-to-add-breadcrumbs-to-your-laravel-website
So from my guess, I think this article will be in a sort of "limbo" state. I don't think it'll get picked up by the pinned articles query because there are newer pinned articles. I also don't think it'll get picked up by the regular articles query because the article is
is_pinned.With my new change, it proposes that if a pinned article isn't included in the 4 pinned articles, it'll then be included int the regular article listing.
I'm hoping what I've done is right (and actually needed/wanted haha!). If this is something you do think might be worth merging, I'd be more than happy to make any changes if needed 😄
I've added some tests to make sure it works programmatically. But I've not done any manual testing because my local env is a little bit broken at the moment haha! So I do apologise if I've done anything wrong or broken anything!